package com.tianze.library.base;

import android.app.Application;
import android.content.Context;

import com.orhanobut.hawk.Hawk;
import com.orhanobut.hawk.HawkBuilder;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
import com.tianze.library.utils.L;

/**
 * Created by kingtami.
 */
public class BaseApplication extends Application {

    protected static Context sContext;

    private RefWatcher refWatcher;

    public static RefWatcher getRefWatcher(Context context) {
        BaseApplication application = (BaseApplication) context.getApplicationContext();
        return application.refWatcher;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        sContext = this;
        refWatcher = LeakCanary.install(this);
        L.init(isEnableDebug());
        Hawk.init(this).setEncryptionMethod(HawkBuilder.EncryptionMethod.NO_ENCRYPTION).build();
    }

    protected boolean isEnableDebug() {
        return false;
    }

}
